//
//  WCOrderDealCell.m
//  CBT
//
//  Created by apple on 2019/7/10.
//  Copyright © 2019 Mr.Zhang. All rights reserved.
//

#import "WCOrderDealCell.h"

@implementation WCOrderDealCell

+ (instancetype)createTableView:(UITableView *)tableView {
    WCOrderDealCell *cell = [tableView dequeueReusableCellWithIdentifier:@"dealCell"];
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor whiteColor];
    
    [cell makeViews];
    
    return cell;
}

- (void)makeViews {
    
    [self.contentView addSubview:self.headLabel];
    [self.headLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(20);
        make.width.mas_equalTo (120);
    }];
    
    [self.contentView addSubview:self.jianBtn];
    [self.jianBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-75);
        make.top.mas_equalTo(10);
        make.width.height.mas_equalTo(20);
    }];
    
    [self.contentView addSubview:self.countLabel];
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-40);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(20);
        make.width.mas_equalTo(30);
    }];
    
    [self.contentView addSubview:self.plusBtn];
    [self.plusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(10);
        make.width.height.mas_equalTo(20);
    }];
}

- (UILabel *)headLabel {
    if (!_headLabel) {
        _headLabel = [[UILabel alloc] init];
        _headLabel.textColor = UIColorFromRGB(0x404040);
        _headLabel.font = [UIFont systemFontOfSize:14];
        _headLabel.text = @"数量";
    }
    
    return _headLabel;
}

- (UIButton *)plusBtn {
    if (!_plusBtn) {
        _plusBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _plusBtn.layer.cornerRadius = 3;
        _plusBtn.titleLabel.font    = [UIFont systemFontOfSize:13];
        _plusBtn.backgroundColor    = UIColorFromRGB(0xdcdcdc);
        [_plusBtn setTitle:@"+" forState:UIControlStateNormal];
    }
    
    return _plusBtn;
}

- (UIButton *)jianBtn {
    if (!_jianBtn) {
        _jianBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _jianBtn.layer.cornerRadius = 3;
        _jianBtn.titleLabel.font    = [UIFont systemFontOfSize:13];
        _jianBtn.backgroundColor    = UIColorFromRGB(0xdcdcdc);
        [_jianBtn setTitle:@"-" forState:UIControlStateNormal];
    }
    
    return _jianBtn;
}

- (UILabel *)countLabel {
    if (!_countLabel) {
        _countLabel = [[UILabel alloc] init];
        _countLabel.textColor = UIColorFromRGB(0x404040);
        _countLabel.font = [UIFont systemFontOfSize:13];
        _countLabel.text = @"0";
        _countLabel.textAlignment = NSTextAlignmentCenter;
    }
    
    return _countLabel;
}


@end
